package com.asset.dispoal.file.judgment.service;

import com.asset.dispoal.file.judgment.api.IJudgmentBookService;
import com.asset.dispoal.file.judgment.dto.JudgmentBookFileDto;
import com.asset.dispoal.file.judgment.service.command.UploadJudgmentBookCommand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import tech.mhuang.pacebox.springboot.protocol.Result;

/**
 * @description:
 * @author: yf
 * @date: 2022-12-13 15:50:48
 */
@Service
public class FileJudgmentBookImpl implements IJudgmentBookService {
    @Autowired
    private UploadJudgmentBookCommand uploadJudgmentBookCommand;

    @Override
    public Result<String> judgmentUpload(String chunks, String chunk, String task_id, String name, MultipartFile file, String filename, String uuid) {
        JudgmentBookFileDto fileDto = new JudgmentBookFileDto();
        fileDto.setFile(file);
        fileDto.setChunk(chunk);
        fileDto.setChunks(chunks);
        fileDto.setTaskId(task_id);
        fileDto.setName(filename);
        fileDto.setUuid(uuid);
        return uploadJudgmentBookCommand.execute(fileDto);
    }

}
